/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Bean;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 *
 * @author Yohanes Beny P
 */
public class Kantor_Cabang {

    private String id, pass, nama;

    public Kantor_Cabang() {
    }

    public Kantor_Cabang(String id, String pass, String nama) {
        this.id = id;
        this.pass = pass;
        this.nama = nama;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPass() {
        return pass;
    }

    public void setPass(String pass) {
        this.pass = pass;
    }

    public String getNama() {
        return nama;
    }

    public void setNama(String nama) {
        this.nama = nama;
    }

    public String tampilNamaCab(String id) throws SQLException {
        String nama = null;
        Connection con = Database.Koneksi.open();
        Statement st = con.createStatement();
        ResultSet rs = st.executeQuery("select NAMA from KANTOR_CABANG_T where ID_KANTOR_CABANG='" + id + "'");
        while (rs.next()) {
            nama = rs.getString("NAMA");
        }
        return nama;
    }

    public ResultSet tampilPengirimanCab_Barang(String cab) throws SQLException {
        Connection con = Database.Koneksi.open();
        Statement st = con.createStatement();
        ResultSet rs1 = st.executeQuery("select * from BARANG_T where NO_RESI like '%" + cab + "%'");
        return rs1;
    }
    
     public ResultSet tampilPengirimanCab_Konsumen(String cab) throws SQLException {
        Connection con = Database.Koneksi.open();
        Statement st = con.createStatement();
        ResultSet rs2 = st.executeQuery("select * from KONSUMEN_T where NO_RESI like '%" + cab + "%'");
        return rs2;
    }
}
